package com.thz.friend.mapper.report;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.thz.friend.pojo.report.Report;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @Description
 * @Author thz
 * @Date 2025/5/13
 */
@Mapper
public interface ReportMapper extends BaseMapper<Report> {

    @Select("select COUNT(*) FROM tb_report WHERE create_user=#{userId}")
    Integer getCompletedCourses(Long userId);

    @Select("select COUNT(*) FROM tb_report WHERE create_user=#{userId} AND course_id=#{courseId} AND blog_id IS NOT NULL")
    Integer selectCourseBlogCount(Long userId,Long courseId);

    @Select("select COUNT(*) FROM tb_report WHERE create_user=#{userId} AND course_id=#{courseId} AND video_id IS NOT NULL")
    Integer selectCourseVideoCount(Long userId, Long courseId);

//    @Select("select * FROM tb_report WHERE course_id=#{id} AND create_user=#{userId} AND blog_id IS NULL AND video_id IS NULL")
//    Report getReports(Long id,Long userId);

}
